Repository navigation
feat: support project tokens linked to several projects, and rotate them from the CLI - #411
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
gregberge
added a commit
to argos-ci/docs
that referenced
this pull request
Nov 5, 2026
argos-ci/argos-javascript#411 adds `argos project token` and `argos account project-token` (list, create, revoke), and lets `finalize`, `skip`, `deploy` and `baseline download` take `--project` for a token linked to several projects. - CLI reference: add both command groups, with their defaults (every permission, no expiration) and the roles they need; drop "baseline download has no --project flag"; say what --project does for a multi-project token. - Project tokens: mention the CLI next to the API, and that ARGOS_PROJECT naming another project fails with a 401 for a single-project token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Regenerate the schema from argos-ci/argos#2747, which is not deployed yet: project tokens (`ProjectToken`, `CreatedProjectToken`, `ProjectTokenPermission`), their endpoints on `/projects/{owner}/{project}/tokens` and `/accounts/{accountSlug}/project-tokens`, and the optional `project` the CI endpoints take to pick one of a token's projects. The rest of the diff is what production already serves and the schema had not caught up with. Refs ARG-519 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A project token can now be linked to several projects. Such a token does not identify a project on its own, so Argos rejects it on the CI endpoints unless the request names one. When `ARGOS_PROJECT` (or the `project` option) is set, send it as `project` to `GET /project`, `POST /builds`, `POST /builds/finalize`, `POST /baseline` and `POST /deployments`. When it is not, send nothing, so a token linked to a single project behaves exactly as before. `POST /media` already took it. - `finalize` and `deploy` take a `project` parameter, like `upload`. - `argos finalize`, `skip`, `deploy` and `baseline download` take `--project`. - `@argos-ci/gitlab` reads `ARGOS_PROJECT`. Setting `ARGOS_PROJECT` to a project the token is not linked to now fails, where the SDK used to ignore it outside tokenless authentication. Needs argos-ci/argos#2747 deployed: until then the API does not know `project` on these endpoints. Refs ARG-519 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`argos project token list|create|revoke` manage a project's tokens on
`/projects/{owner}/{project}/tokens`, so CI tokens can be rotated from
the terminal: create the replacement, update the CI secret, revoke the
old one.
`argos account project-token list|create|revoke` do the same on
`/accounts/{accountSlug}/project-tokens`, the only place a token linked
to several projects can be created (`--projects web,docs`).
`create` takes `--name`, `--permissions` (comma-separated, all of them
by default) and `--expire-at <iso>` or `--expires-in <days>` (never, by
default), and prints the token: Argos returns it once. Permissions and
dates are checked before the request, and dates are sent in the UTC ISO
format the API takes.
The argos-cli and argos-upload skills cover tokens linked to several
projects, missing permissions and the rotation flow.
Needs argos-ci/argos#2747 deployed: the endpoints answer 404 until then.
Refs ARG-519
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mands - `--project` / `ARGOS_PROJECT` is resolved by one `resolveProjectPath` in `lib/target.ts`, now also used by `baseline download`, which checks the `owner/project` format before calling the API. - `toPositiveInteger` and `toIsoOrFail` move to `options.ts`, shared by `--limit`, `--pr`, `analytics --from/--to` and the token expiration flags. - `--permissions` and `--projects` are variadic options, like `upload --files`: commander checks permissions against their choices, so the hand-written list parsers go. - The token body type is inferred against the generated schema, and the conflict between `--expire-at` and `--expires-in` is declared once. - Core tests record `POST /builds` and `POST /builds/finalize` bodies in the default mock handlers instead of copying them per test. Refs ARG-519 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
argos-ci/argos#2747 changed, at 749192a65: - A token created without `permissions` gets `builds:write` and `deployments:write` only, not every permission. The `--permissions` help and the argos-cli skill say so, and the rotation flow tells to add `projects:read` or `media:*` when CI needs them. - `expireAt` is required (`null` for never). The CLI already always sends it; the generated types now enforce it, and a test pins it. - A token linked to a single project ignores `project`, so a stale `ARGOS_PROJECT` keeps working with it. The `uploadMedia` doc no longer says a project token always ignores it: one linked to several needs it. The API client is regenerated from that commit. Refs ARG-519 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
argos-ci/argos#2747 changed back at c9d3f56d1: a token created without `permissions` gets every permission. The `--permissions` help and the argos-cli skill's rotation flow say so again. The API client is regenerated from that commit. It also picks up what production already serves: `autoApprovalEnabled` on projects, and the retired `/auth/cli/token` exchange, which nothing here calls. Refs ARG-519 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
argos-ci/argos#2747 merged with no change to the token API since the last regeneration. The diff only picks up reworded endpoint descriptions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gregberge
force-pushed
the
claude/gracious-rhodes-ec05c1
branch
from
November 16, 2026 11:01
644b377 to
4919f56
Compare
`project token create` and `revoke` need the `projects:write` scope, which `argos login` grants only with "Admin" access. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Release only once argos-ci/argos#2747 is deployed. It merged on 2026-11-16, but production doesn't serve the token endpoints yet. Until then the token commands answer 404. The
projectfield is harmless on today's API, which strips unknown fields, but it does nothing.Description
argos-ci/argos#2747 replaces the single
projects.tokenwith project tokens. A token can be linked to several projects, carries permissions and can expire. This PR makes the SDK and the CLI work with them.Name the project on the CI endpoints
A token linked to several projects does not identify a project by itself, so the API answers 400 unless the request names one. When
ARGOS_PROJECT(or theprojectoption) is set,@argos-ci/corenow sends it asprojectto:GET /project(query)POST /builds,POST /builds/finalize,POST /baseline,POST /deployments(body)POST /mediaalready took it. Whenprojectis unset, nothing is sent. A token linked to a single project ignoresproject, so single-project tokens behave exactly as today, even with a staleARGOS_PROJECT.finalize()anddeploy()gain aprojectparameter, likeupload().skip()accepts one too.argos finalize,skip,deployandbaseline downloadtake--project.@argos-ci/gitlabreadsARGOS_PROJECTfor itsGET /project.Rotate tokens from the CLI
projectcommands use/projects/{owner}/{project}/tokens. Theaccountcommands use/accounts/{accountSlug}/project-tokens, the only endpoint that can create a token linked to several projects.createprints the token, since the API returns it only once. With--json, the value is intoken.--permissionsand--projectstake space-separated values, likeupload --files. If--permissionsis omitted, the CLI leaves it out and the API's default applies: every permission.expireAtis always sent, which the API requires, asnullfor a token that never expires. Commander rejects unknown permissions before the request is sent.--expire-atand--expires-incan't be used together. The date must be in the future, and it is sent as UTC ISO, the only formatz.iso.datetime()accepts.revokereturns{ revoked, tokenId }, likecontributor remove. Token names go throughsanitizeTerminalText.API client
packages/api-client/src/schema.tsis regenerated from argosmainat the #2747 merge commit (12b68f409) withpnpm --filter @argos/backend generate-openapi. Most of the diff is drift that production already serves (capture,Agent,awaitingReviewStatus, analyticsstorybook…). I checked this by diffing production'sopenapi.yamlagainst that spec: they differ only in the token changes.Skills
argos-cliandargos-uploadnow cover tokens linked to several projects, the 403 for a missing permission, and the rotation flow, which pipescreate --json | jq -r .token | gh secret set ARGOS_TOKENso the value is never echoed.No changeset files: Lerna versions from the conventional commits.
Tests
@argos-ci/core:upload,skip,finalizeanddeploysendprojectwhen it is passed or set inARGOS_PROJECT, and send no field or query param when it is not. The upload test also covers the/baselinelookup.@argos-ci/cli: unit tests for expiration handling, the request body and the token formatters.finalize,skip,deployandbaseline downloadwith and without--project/ARGOS_PROJECT.Refs ARG-519
🤖 Generated with Claude Code